<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>流程设计器</title>
  <style>
    * {
      user-select: none;
    }

    body {
      margin: 0;
      font-family: Arial, sans-serif;
      display: flex;
      height: 100vh;
      overflow: hidden;
    }

    .toolbar {
      width: 200px;
      background: #f5f5f5;
      padding: 20px;
      border-right: 1px solid #ddd;
      z-index: 1;
    }

    .toolbar button {
      display: block;
      width: 100%;
      margin-bottom: 10px;
      padding: 10px;
      background: #fff;
      border: 1px solid #ddd;
      border-radius: 4px;
      cursor: pointer;
      user-select: none;
    }

    .canvas {
      flex: 1;
      position: relative;
      overflow: auto;
      background-color: whitesmoke;
      z-index: 1;
    }

    .node {
      position: absolute;
      width: 50px;
      height: 50px;
      border: 2px solid #629562;
      border-radius: 50%;
      background: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: move;
      user-select: none;
      text-align: center;
      padding: 8px;
    }

    .port {
      position: absolute;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #fff;
      border: 1px solid;
      cursor: pointer;
    }

    .in-port {
      border-color: #4CAF50;
    }

    .out-port {
      border-color: #2196F3;
    }

    .start-node .in-port {
      display: none;
    }

    .end-node .out-port {
      display: none;
    }

    .branch-node .in-port {
      left: 0;
      top: 38px;
      transform: translateX(-50%);
    }

    .merge-node .out-port {
      right: 0;
      top: 38px;
      transform: translateX(50%);
    }

    .start-node {
      border-color: #4CAF50;
    }

    .end-node {
      border-color: #F44336;
    }

    .branch-node {
      border-color: #2196F3;
      color: #2196F3;
      font-size: 48px;
    }

    .merge-node {
      border-color: #FF9800;
      color: #FF9800;
      font-size: 32px;
    }

    .line {
      width: 300px;
      height: 3px;
      background-color: rgb(78, 67, 67);
      font-size: 16px;
      position: absolute;
      cursor: pointer;
      user-select: none;
      transform-origin: left center;
      z-index: 5;
    }

    .line .arrow {
      position: absolute;
      color: rgb(78, 67, 67);
      right: -4px;
      top: -10px;
      user-select: none;
    }

    .node-label {
      user-select: none;
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      width: 120px;
      background: transparent;
      border: none;
      outline: none;
      text-align: center;
      font-size: 12px;
      color: #333;
      padding: 2px;
      margin-top: 5px;
    }

    .node-label:focus {
      border-bottom: 1px solid #2196F3;
    }

    .node-context-menu {
      background: #fff;
      border: 1px solid #ddd;
      border-radius: 4px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      z-index: 1000;
      min-width: 120px;
    }

    .menu-item {
      padding: 8px 16px;
      font-size: 14px;
      color: #333;
      cursor: pointer;
      user-select: none;
    }

    .menu-item:hover {
      background: #f5f5f5;
    }

    .menu-item:active {
      background: #e0e0e0;
    }

    .mask {
      position: absolute;
      background: rgb(52, 52, 52);
      opacity: 0.4;
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: 50;
      display: none;
    }

    #nodePropDialog{
      border: 1px solid rgb(159, 231, 171);
    }
  </style>

  <script defer src="./require.min.js" data-main="./js/main.js"></script>
</head>

<body>

  <div class="toolbar">
    <button data-type="start">开始节点</button>
    <button data-type="end">结束节点</button>
    <button data-type="normal">一般节点</button>
    <button data-type="branch">分支器</button>
    <button data-type="merge">聚合器</button>
    <button data-type="line">连接线</button>
  </div>

  <div class="canvas"></div>

  <div class="mask"></div>


  <!-- 定义一个模态对话框，初始是隐藏的 -->
  <dialog id="nodePropDialog">
    <h2></h2>
    <iframe src="./view/blank.html" title="属性编辑" frameborder="0" style="border: 0;"></iframe>
  </dialog>

</body>

</html>